﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="XinYongHuJHSR.aspx.cs" Inherits="Web.Pages.YongShui.JiHuaGL.XinYongHuJHSR" Theme="Default" ValidateRequest="false" %>
<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../../JS/jquery.js" type="text/javascript"></script>
    <script src="../../../JS/AddEditCancel.js" type="text/javascript"></script>
    <script type="text/javascript">
        
        //计划用水量输入框验证
        //var value = true;

        //function TextChange(obj) {
        //    if (value) {
        //        obj.SetText(obj.GetText() * 100);
        //    }

        //    if (obj.GetText() == " ") {
        //        obj.SetText("0");
        //    }
        //    var total = GetInt("txtYiYue_I") + GetInt("txtErYue_I") + GetInt("txtSanYue_I") + GetInt("txtSiYue_I") + GetInt("txtWuYue_I") + GetInt("txtLiuYue_I")
        //    + GetInt("txtQiYue_I") + GetInt("txtBaYue_I") + GetInt("txtJiuYue_I") + GetInt("txtShiYue_I") + GetInt("txtShiYiYue_I") + GetInt("txtShiErYue_I");

        //    $("#txtQuanNian_I").val(total);
        //}

        //function GetCheckBoxValue(s, e) {
        //    value = s.GetChecked();
        //}

        //function GetInt(string) {
        //    return parseInt($("#" + string + "").val());
        //}

        //function InitValue(s, e) {
        //    if (s.GetText() == "0") {
        //        s.SetText(" ");
        //    }
        //}

        function txtMChange(s) {
            //debugger;
            GetInt(s);
            if (ChkShuRu.GetChecked()) {
                s.SetText(s.GetText() * 100);
            }
            recountSum();
        }

        function recountSum() {
            var total = GetNum(txtM1) + GetNum(txtM2) + GetNum(txtM3) + GetNum(txtM4) + GetNum(txtM5) + GetNum(txtM6) +
           GetNum(txtM7) + GetNum(txtM8) + GetNum(txtM9) + GetNum(txtM10) + GetNum(txtM11) + GetNum(txtM12);
            txtQuanNianLJ.SetText(total);
        }

       
        //全年相同
        function QuanNianXT() {
            if (parseInt(txtM1.GetText()) != NaN && parseInt(txtM1.GetText()) != "") {
                txtM2.SetText(parseInt(txtM1.GetText()));
                txtM3.SetText(parseInt(txtM1.GetText()));
                txtM4.SetText(parseInt(txtM1.GetText()));
                txtM5.SetText(parseInt(txtM1.GetText()));
                txtM6.SetText(parseInt(txtM1.GetText()));
                txtM7.SetText(parseInt(txtM1.GetText()));
                txtM8.SetText(parseInt(txtM1.GetText()));
                txtM8.SetText(parseInt(txtM1.GetText()));
                txtM10.SetText(parseInt(txtM1.GetText()));
                txtM11.SetText(parseInt(txtM1.GetText()));
                txtM12.SetText(parseInt(txtM1.GetText()));
                recountSum();
            }
        }

        //保存
        function Save() {
            //gvYongHuXX.SetRowKey(gvYongHuXX.GetFocusedRowIndex())
            //listCover("true", "gridTab");
            ASPxCallback1.PerformCallback("save");
        }


        function ASPxCallback1Complete(rs) {
            var arr = rs.split('|');
            var type = arr[0];
            var state = arr[1];
            var specialIdentity = arr[2];
            var msg = arr[3].split('-');
            if (msg[0] == 'True') {
                alert(msg[1]);
            }
            //debugger;
            hdCollection.Set("type", type);
            if (state == 'True') {
                if (type == "save") {
                    $("#GridViewContentTable").css("display", "none");
                    btnCancel.OnClick();
                    //gvYongHuXX.PerformCallback();
                }
               
            }
        }
        
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div class="tabletitle1" align="center">
            新用户计划输入
        </div>
        <dx:ASPxHiddenField ID="ASPxHiddenField1" ClientInstanceName="hdCollection" runat="server"></dx:ASPxHiddenField>
        <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallback1Complete(e.result);}"></dx:ASPxCallback>
        <dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="LoadPanel" runat="server" ContainerElementID="gvYongHuXX"></dx:ASPxLoadingPanel>
       
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <table style="width: 80%">
                    <tr>
                        <td style="white-space: nowrap; width: 1%">年：</td>
                        <td style="white-space: nowrap; width: 15%">
                            <dx:ASPxComboBox runat="server" ID="cmdYear" Width="100px" AutoPostBack="True" OnSelectedIndexChanged="cmdYear_SelectedIndexChanged">
                            </dx:ASPxComboBox>
                        </td>
                        <td style="white-space: nowrap; width: 48%; float:left;">
                            <asp:Panel runat="server" ID="NowOrNextM">
                                <dx:ASPxComboBox runat="server" ID="cmbBeiXiaYue" Width="40%" AutoPostBack="true" OnSelectedIndexChanged="cmbBeiXiaYue_SelectedIndexChanged">
                                    <Items>
                                        <dx:ListEditItem Text="本月新用户" Value="0" Selected="true" />
                                        <dx:ListEditItem Text="下月新用户" Value="1" />
                                    </Items>
                                </dx:ASPxComboBox>
                            </asp:Panel>
                        </td>
                        
                    </tr>
                </table>
                <div>
                    <div align="right" id="gridTab">
                        <dx:ASPxGridView ID="gvYongHuXX" ClientInstanceName="gvYongHuXX" runat="server" OnCustomCallback="gvYongHuXX_CustomCallback"
                             AutoGenerateColumns="False" KeyFieldName="ID" 
                            Theme="Aqua1" Width="100%">
                            <Columns>
                                <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_ZHANDIANBH" Caption="管理部门" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="GUANLIK" Caption="管理块" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="XINGZHENGQ" Caption="行政区" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_JUBIANH" Caption="局号" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_GONGSIBH" Caption="公司号" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="200">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_DIZHI" Caption="用户地址" Width="200">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_YOUBIAN" Caption="邮编" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_LIANXIBM" Caption="联系部门" Width="170">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_LIANXIR" Caption="联系人" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_LIANXIDH" Caption="联系电话" Width="120">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_YINHANGZH" Caption="银行帐号" Width="180">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_KAIHUHM" Caption="开户户名" Width="200">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_KAIHUYH" Caption="开户银行" Width="200">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="SHOUFEIFS" Caption="收费方式" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="YONGSHUIXZ" Caption="用水性质" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="SHESHUIDXDM" Caption="行业类型" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="KAOHEFY" Caption="考核复用" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="I_SHIKAOHY" Caption="试考核月" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="" Caption="自来水表数" Width="80">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="" Caption="回灌表数" Width="70">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="YEWUY" Caption="业务员" Width="70">
                                </dx:GridViewDataTextColumn>
                                 <dx:GridViewDataTextColumn FieldName="I_JLZT" Caption="记录状态" Width="60">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="" Caption="累计加价状态">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="" Caption="累计加价次数">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="S_YUANYONGHUH" Caption="原用户编号" Width="80">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="D_XIUGAIRQ" Caption="修改日期" Width="85" PropertiesTextEdit-DisplayFormatString="yyyy-MM-dd">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="D_LIHURQ" Caption="立户日期" Width="85" PropertiesTextEdit-DisplayFormatString="yyyy-MM-dd">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="D_HUJIXGRQ" Caption="户籍管理日期" Width="85" PropertiesTextEdit-DisplayFormatString="yyyy-MM-dd">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="GONGSM" Caption="公司名">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="JUMINGC" Caption="局名">
                                </dx:GridViewDataTextColumn>

                                <dx:GridViewDataTextColumn FixedStyle="Left" Width="40px">
                                    <DataItemTemplate>
                                        <asp:LinkButton ID="lnbModify" runat="server" CausesValidation="false" Text="修改"
                                            CommandArgument='<%#Eval("ID")%>' OnCommand="lnbModify_Command" OnClientClick="function(s,e){load();}">
                                            
                                        </asp:LinkButton>
                                    </DataItemTemplate>
                                </dx:GridViewDataTextColumn>

                            </Columns>
                            <Settings VerticalScrollableHeight="320" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" />
                        </dx:ASPxGridView>
                    </div>
                    <div style="height: 2px;"></div>
                    <div id="GridViewContentTable" runat="server">
                        <br />
                        <div class="tabletitle1" align="center">
                            <asp:Label runat="server" ID="lblOperateTip">修改</asp:Label>
                        </div>
                        <table style="width: 100%;">
                            <tr style="height: 25px">
                                <td colspan="2" style="width: 10%; text-align: right">用户号：</td>
                                <td style="width: 8%" align="left">
                                    <dx:ASPxTextBox ID="txtYongHuH" Width="90%" runat="server" Enabled="false">
                                    </dx:ASPxTextBox>
                                </td>
                                <td></td>
                                <td colspan="2" style="width: 10%; text-align: right">用户名：</td>
                                <td colspan="2" style="width: 20%" align="left">
                                    <dx:ASPxTextBox ID="txtYongHuM" Width="80%" runat="server" Enabled="false">
                                    </dx:ASPxTextBox>
                                </td>
                            </tr>
                            <tr style="height: 25px">
                                <td colspan="2" style="width: 10%; text-align: right">局号：</td>
                                <td style="width: 8%" align="left">
                                    <dx:ASPxTextBox ID="txtJuHao" Width="90%" runat="server" Enabled="false">
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 20%" align="left">
                                    <dx:ASPxTextBox ID="txtJuHao2" runat="server" Enabled="false">
                                    </dx:ASPxTextBox>
                                </td>
                                <td colspan="2" style="width: 10%; text-align: right">公司号：</td>
                                <td style="width: 8%" align="left">
                                    <dx:ASPxTextBox ID="txtGongSiM" Width="90%" runat="server" Enabled="false">
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 20%" align="left">
                                    <dx:ASPxTextBox ID="txtGongSiM2"  runat="server" Enabled="false">
                                    </dx:ASPxTextBox>
                                </td>
                            </tr>
                        </table>
                        <table id="yuefen" style="width: 100%; border: 1px solid #5aa0a3;">
                            <tr>
                                <td colspan="8"></td>
                            </tr>
                            <tr>
                                <td style="width: 5%; text-align: right;">1月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM1" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM1">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM2);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}"  GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right;">4月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM4" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM4">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM5);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}"  GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right;">7月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM7" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM7">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM8);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right">10月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM10" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM10">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM11);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 5%; text-align: right">2月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM2" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8"  ClientInstanceName="txtM2">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM3);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right">5月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM5" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM5">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM6);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right">8月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM8" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM8">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM9);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right">11月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM11" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM11" >
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM12);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 5%; text-align: right">3月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM3" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM3">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM4);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right">6月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM6" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM6">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM7);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right">9月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM9" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM9">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(txtM10);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                                <td style="width: 5%; text-align: right">12月：</td>
                                <td style="width: 20%; text-align: right;">
                                    <dx:ASPxTextBox ID="txtM12" runat="server" HorizontalAlign="Right" Width="60%" MaxLength="8" ClientInstanceName="txtM12">
                                    <ClientSideEvents KeyPress="function(s,e){OnKeyNext(btnSave);}" TextChanged="function(s,e){txtMChange(s);}" LostFocus="function(s,e){LostFocus(s);}" GotFocus="function(s,e){GetFocus(s);}"/>
                                    </dx:ASPxTextBox>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="8"></td>
                            </tr>
                        </table>
                        <div style="width: 100%; height: 20px;">
                            <div style="float: left; width: 200px;">
                                
                                <dx:ASPxCheckBox Checked="true" ID="ChkShuRu" runat="server" Text="百立方米输入" Width="80%" ClientInstanceName="ChkShuRu">
                                    <ClientSideEvents  /><%--CheckedChanged="function(s,e){GetCheckBoxValue(s,e);}"--%>
                                </dx:ASPxCheckBox>
                            </div>
                            <div style="float: right; width: 200px;">
                                <table>
                                    <tr>
                                        <td style=""><span>全年：</span></td>
                                        <td>
                                            <dx:ASPxTextBox  ID="txtQuanNianLJ" runat="server" MaxLength="10" HorizontalAlign="Right" Width="80%" ClientInstanceName="txtQuanNianLJ">
                                                <ClientSideEvents />
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <table id="GridViewButtonTable" runat="server" style="width: 100%">
                            <tr>
                                <td style="text-align: right;">
                                    <hr />
                                    <%--<dx:ASPxButton ID="btnQuanNianXT" runat="server" Text="全年相同" AutoPostBack="false" UseSubmitBehavior="false">
                                        <ClientSideEvents Click="function(s,e){QuanNianXT();}" />
                                    </dx:ASPxButton>--%>
                                    <dx:ASPxButton ID="btnSave" runat="server" ClientInstanceName="btnSave"  Text="保存" ClientSideEvents-Click="function(s,e){Save();}" UseSubmitBehavior="false" AutoPostBack="false">
                                       
                                    </dx:ASPxButton>
                                    <dx:ASPxButton ID="btnCancel" runat="server" Text="放弃" OnClick="btnCancel_Click" UseSubmitBehavior="false" ClientInstanceName="btnCancel">
                                    </dx:ASPxButton>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div style="display: none;">
                    <asp:Button ID="btnSaveFact"  runat="server" Text="Button" OnClick="btnSaveFact_Click" />
                    <asp:HiddenField ID="confirmValue" runat="server" />
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        
    </form>
</body>
</html>
